#include "apue.h"
#include <unistd.h>

#define BUFSIZE 4096

void read_write_test(void);

int main(int argc, char const *argv[])
{
    read_write_test();
    return 0;
}

void read_write_test(void)
{
    ssize_t n;
    char buf[BUFSIZE] = {0};
    while ((n = read(STDIN_FILENO, buf, BUFSIZE)) > 0)
    {
        if (write(STDOUT_FILENO, buf, n) != n)
        {
            err_sys("write error");
        }
    }
    
    if (n < 0)
    {
        err_sys("read error");
    }
    
}


